/**
 * create by young (young2f@outlook.com) on 2020/9/12
 */

'use strict';
import React from 'react';
import {connect} from 'dva/index';
import {Button, Card, Col, DatePicker, Form, Popconfirm, Row, Select, Statistic, Table} from 'antd';
import styles from '../../index.less';
import ViewTitle from '../../../components/ViewTitle';
import FormBase from '../../../components/Base/FormBase';
import notify from "../../../components/NotificationExtra";
import {ModalView} from 'antd-extra';
import moment from 'moment';
import 'moment/locale/zh-cn';
import ModalPaymentRecordDetail from "../modal/ModalPaymentRecordDetail";
import ModalReceiptRecordDetail from "../modal/ModalReceiptRecordDetail";

moment.locale('zh-cn');
const {RangePicker} = DatePicker;
const _ = require('lodash');

const {Option} = Select;
@Form.create()
@connect(({
            user,
            global,
            finance
          }) => ({...user, ...global, ...finance}))
export default class MoneyAssess extends FormBase {
  constructor(props) {
    super(props);
    this.state = {};
  }

  componentDidMount() {

  }

  cols = () => {
    return [
      {
        title: '编码',
        dataIndex: 'code',
        key: 'code'
      },
      {
        title: '户名',
        dataIndex: 'accountName',
        key: 'accountName'
      },
      {
        title: '开户行',
        dataIndex: 'openingBank',
        key: 'openingBank'
      },
      {
        title: '账号',
        dataIndex: 'account',
        key: 'account'
      },
      {
        title: '初始余额',
        dataIndex: 'initBalance',
        key: 'initBalance'
      },
      {
        title: '当前结余',
        dataIndex: 'balance',
        key: 'balance'
      }];
  };

  render() {
    const {financeAssess} = this.props;
    const {amountTotal = 0, accountList = []} = financeAssess;
    return <div>
      <div style={{background: '#ECECEC', padding: '30px'}}>
        <Row gutter={16}>
          <Col span={6}>
            <Card>
              <Statistic
                title="资金总额"
                value={amountTotal}
                precision={2}
                valueStyle={{color: '#11f'}}
                suffix="元"
              />
            </Card>
          </Col>

        </Row>
      </div>
      <ViewTitle
        title={'资金账户列表'}
      ></ViewTitle>
      <Table
        className={styles.antTable}
        bordered={true}
        columns={this.cols()}
        dataSource={accountList}
        scroll={{x: true}}
        pagination={true}
        //scroll={{ x: 1300 }}
      ></Table>

    </div>;
  }
}
